package com.qiangesoft.log.core;

import com.qiangesoft.log.service.IOperationLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 操作日志记录处理监听器
 *
 * @author qiangesoft
 * @date 2024-04-02
 */
@Component
@RequiredArgsConstructor
public class OperationLogListener implements ApplicationListener<OperationLogEvent> {

    private final IOperationLogService operationLogService;

    @Override
    public void onApplicationEvent(OperationLogEvent event) {
        operationLogService.save(event.getOperationLog());
    }
}
